/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package assignment_cp3120.deleteUser;

import assignment_cp3120.DAO.Factory.DAOFactory;
import assignment_cp3120.auth.Authenticate;

/**
 * Model for the DeleteUser use case
 * @author Administrator
 */
public class DeleteUserModel {
    /**
     * Final for button action commands: cancel
     */
    public final String CANCEL = "cancel";
    /**
     * Final for button action commands: delete
     */
    public final String DELETE = "delete";

    /**
     * Function to delete a user from the data base.
     */
    public void deleteUser() {
        DAOFactory.getDAOFactory().getUserDAO().deleteUser(Authenticate.getCurUser().getUsername());
    }
    
    /**
     * Validate that the current user is the same as the username and password that was given to the program.
     * --- Validate may need to be moved to Authenticate class but unknown at this time.
     * @param username
     * Username to compare
     * @param password
     * Password to compare
     * @return
     * Ture if valid
     */
    public boolean validate(String username, String password) {        
        return Authenticate.getCurUser().getUsername().equals(username) 
                && Authenticate.getCurUser().getPassword().equals(password);
    }

}
